Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move collecting up tokens for a symbol to RubyLex #462

Merged
merged 1 commit into from
Jul 18, 2017

Conversation

aycabta
Copy link
Member

@aycabta aycabta commented Jul 17, 2017

RDoc::Markup::ToHtml uses RDoc::RubyLex.tokenize directly and calls RDoc::TokenStream.to_html with returned tokens.

On the one hand, RDoc::Parser::RubyTools#get_tk collects up TkSYMBEG and trailing tokens inside the symbol with tokens by RDoc::RubyLex.

I moved logic what collects up tokens for a symbol from RDoc::Parser::RubyTools#get_tk to RDoc::RubyLex. So RDoc::TokenStream.to_html becomes to handle symbols as value.

Before, each symbols are separeted TkSYMBEG and trailing tokens:

separeted symbol

<pre class="ruby">
<span class="ruby-identifier">a</span> = :<span class="ruby-identifier">hoge</span>
</pre>

I think what : and hoge with ruby-identifier attribute are separeted is not correct because symbol is one literal and one value. It's not identifier.

After, each symbols are treated as literal with ruby-value attribute.

collected up symbol

<pre class="ruby">
<span class="ruby-identifier">a</span> = <span class="ruby-value">:hoge</span>
</pre>

RDoc::Markup::ToHtml uses RDoc::RubyLex.tokenize directly and
calls RDoc::TokenStream.to_html with returned tokens.

On the one hand, RDoc::Parser::RubyTools#get_tk collects up
TkSYMBEG and trailing tokens inside the symbol
with tokens by RDoc::RubyLex.

I moved logic what collects up tokens for a symbol
from RDoc::Parser::RubyTools#get_tk to RDoc::RubyLex.
So RDoc::TokenStream.to_html becomes to handle symbols as value.
@zzak zzak merged commit 1a68297 into ruby:master Jul 18, 2017
@aycabta aycabta deleted the move-collecting-up-symbol-to-ruby-lex branch July 18, 2017 10:45
@hsbt
Copy link
Member

hsbt commented Jul 18, 2017

@zzak Are you done to review this pull-request?

We should review to change code without test code before merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants